CMAKE_MINIMUM_REQUIRED(VERSION 3.20)
PROJECT(EpubDukpt)

SET(CMAKE_CXX_STANDARD 17)
SET(CMAKE_CXX_EXTENSIONS OFF)

SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)

ADD_SUBDIRECTORY(m_thrd/openssl)

UNSET(THIRD_PARTY)
LIST(APPEND THIRD_PARTY LIBRARIES::OPENSSL)

ADD_LIBRARY(EpubDukpt SHARED m_apps/m_library.cpp)
ADD_LIBRARY(LIBRARIES::DUKPT ALIAS EpubDukpt)
TARGET_LINK_LIBRARIES(EpubDukpt PRIVATE ${THIRD_PARTY})
TARGET_INCLUDE_DIRECTORIES(EpubDukpt PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/m_incl")

ADD_EXECUTABLE(EpubDukptTest1 m_apps/m_test1.cpp)
TARGET_LINK_LIBRARIES(EpubDukptTest1 PRIVATE EpubDukpt)

INSTALL(TARGETS EpubDukpt
        LIBRARY DESTINATION lib
        ARCHIVE DESTINATION lib
        RUNTIME DESTINATION bin
        PUBLIC_HEADER DESTINATION include)
